package com.rainsoftware.LicenseSystem.controllers.api;

import com.rainsoftware.LicenseSystem.services.KeypairService;
import com.rainsoftware.LicenseSystem.utils.StandardResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/keypairs")
public class KeypairController {

    private final KeypairService keypairService;

    @Autowired
    public KeypairController(KeypairService keypairService) {
        this.keypairService = keypairService;
    }

    @GetMapping
    public ResponseEntity<String> getPublicKey() {
        StandardResponse response = keypairService.getPublicKey();
        return response.build();
    }
}